package com.labrecruit.system.controller;


import com.labrecruit.system.core.AjaxResult;
import com.labrecruit.system.core.controller.BaseController;
import com.labrecruit.system.domain.StuApply;
import com.labrecruit.system.service.IApplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 管理员Controller层
 */
@RestController
@RequestMapping("/admin")
public class AdminController extends BaseController {
    @Autowired
    private IApplyService applyService;

    /**
     * 获取报名列表
     */
    @GetMapping("/getInfo")
    public AjaxResult getInfo(StuApply apply){
        List<StuApply> list = applyService.selectUserList(apply);
        return success(list);
    }

    /**
     * 获取审核列表
     */
    @GetMapping("/getApply")
    public AjaxResult getApply(StuApply apply){
        List<StuApply> list = applyService.selectApplyList(apply);
        return success(list);
    }

    /**
     * 修改审核状态
     */
    @PutMapping
    public AjaxResult editStatus(@Validated @RequestBody StuApply apply){
        return toAjax(applyService.updateApplyStatus(apply));
    }

}
